﻿
namespace Test30.Engine
{
    public class OneShotBehavior:Behavior
    {
        public override bool NeedsUserInput => _action == null;

        public OneShotBehavior()
        {
        }

        public OneShotBehavior(Action action)
        {
            _action = action;
        }

        public override Action NextAction()
        {
            // clear the action so it is only used once
            Action action = _action;
            _action = null;

            return action;
        }

        private Action _action;
    }
}
